package com.gs.synedocket.dialog;

import android.app.Dialog;

import com.gs.synedocket.control.PopupWindow;

public class DialogUtil {

    private static volatile DialogUtil instance;

    public DialogUtil() {
    }

    public static DialogUtil getInstance() {
        if (instance == null) {
            synchronized (DialogUtil.class) {
                if (instance == null) {
                    instance = new DialogUtil();
                }
            }
        }
        return instance;
    }

    public void dialogDestroy(Dialog dialog){
        if (dialog != null && dialog.isShowing()) {
            dialog.dismiss();
        }
    }

    public void dialogDestroy(Dialog[] dialogs){
        if (dialogs.length > 0) {
            for (Dialog dialog : dialogs) {
                if (dialog != null && dialog.isShowing()) {
                    dialog.dismiss();
                }
            }
        }
    }

    public void dialogDestroy(PopupWindow window){
        if (window != null && window.isShowing()) {
            window.dismiss();
        }
    }
}
